<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div class="box">盒子</div>
    <div class="box">盒子</div>
    <div id="nav">
        <ul>
            <li>
                首页
            </li>
            <li>
                产品
            </li>
        </ul>
    </div>
    <script>
        //getElementsByClassName 根据类目获取元素
        var boxs = document.getElementsByClassName('box');
        console.log(boxs);
        //querySelector 返回指定选择器的第一个对象
        var firstBox = document.querySelector('.box');
        console.log(firstBox);
        //querySelectorAll  返回指定选择器的所有元素对象  返回 伪数组
        var allBox = document.querySelectorAll('.box');
        console.log(allBox);
        //获取body元素
        console.log(document.body);
        //获取html元素
        var htmlEle = document.documentElement;
        console.log(htmlEle);
    </script>

</body>
</html>